package cn.wdm.ymcc.feign;

import cn.wdm.ymcc.result.JSONResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class UserFeignClientFallBackFactory implements FallbackFactory<UserFeignClient> {

    @Override
    public UserFeignClient create(Throwable throwable) {
        return new UserFeignClient() {
            @Override
            public JSONResult list() {
                throwable.printStackTrace();
                return JSONResult.error("服务不可达");
            }
        };
    }
}
